<!-- 仅 card 可用（需要 card.itemid） -->

<template>
  <transition name="open-top-right">
    <CardEditEventBox v-if="bIsShow" :data="data" @close="bIsShow=false"></CardEditEventBox>
  </transition>
</template>

<script>
  import { EventBus } from '@/utils'
  import CardEditEventBox from '@/views/card/event/CardEditEventBox.vue';
  export default {
    name: 'cardEditEvent',
    data() {
      return {
        bIsShow: false,
        data: {},
      }
    },
    components: {
      CardEditEventBox,
    },
    mounted() {
      EventBus.$on('selectEvent', this.selectEvent);
    },
    methods: {
      selectEvent(args) {
        this.bIsShow = true;
        this.data = args;
      },
    },
    beforeUnmount() {
      EventBus.$off('selectEvent');
    },
  }
</script>

<style lang="scss">
  .open-top-right-enter-active, .open-top-right-leave-active {
    transform-origin: top right;
    transition: all .3s;
  }
  .open-top-right-enter, .open-top-right-leave-to /* .fade-leave-active below version 2.1.8 */ {
    transform: scale(0);
    opacity: 0;
  }
</style>
